/*******************************************************************************
 * This file is part of blueprint4j www.blueprint4j.org.
 * 
 *     blueprint4j is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU Lesser General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * 
 *     blueprint4j is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU Lesser General Public License for more details.
 * 
 *     You should have received a copy of the GNU Lesser General Public License
 *     along with blueprint4j. If not, see <http://www.gnu.org/licenses/>.
 ******************************************************************************/
package blueprint4j.gui;

import java.util.Vector;

import blueprint4j.utils.BindException;

public class VectorBinder {
	private Vector store=new Vector();

	public Binder get(int pos){
		return (Binder)store.get(pos);
	}

	public boolean contains(Binder binding){
		return store.contains(binding);
	}

	public void add(Binder item){
		store.add(item);
	}

	public boolean remove(Binder item){
		return store.remove(item);
	}

	public Binder remove(int pos){
		return (Binder) store.remove(pos);
	}

	public int size(){
		return store.size();
	}

	public boolean isChanged() {
		for (int t=0;t<size();t++){
			if (get(t).isChanged()){
				return true;
			}
		}
		return false;
	}

	public void save()
	throws BindException {
		for (int t=0;t<size();t++){
			get(t).save();
		}
	}

	public void restore() {
		for (int t=0;t<size();t++){
			get(t).restore();
		}
	}

	public void reload()
	throws BindException {
		for (int t=0;t<size();t++){
			get(t).reload();
		}
	}
}

